import eventBus from '@/utils/bus'
export const bus = {
  mounted() {
    this.getEventBus()
  },
  beforeDestroy() {
    this.offEventBus()
  },
  methods: {
    getEventBus() {
      eventBus.$on('selectChange', target => {
        if (this.id !== target.id) return
        const params = { selectValue: target.value }
        this.getServeData(params).then(res => {
          this.renderData = res
          this.initChart()
        })
        console.log(target, 'target')
      })
    },
    offEventBus() {
      eventBus.$off('selectChange')
    }
  }
}
